# Copyright (c) YugaByte, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied.  See the License for the specific language governing permissions and limitations
# under the License.
#

# We need access to the generated pg_type_d.h header from this directory.
include_directories("${YB_BUILD_ROOT}/postgres_build/src/include/catalog")

add_library(pggate_test
            pggate_test.cc
            pggate_testvars.cc
            pggate_testapi.cc)

target_link_libraries(pggate_test
                      yb_pggate
                      yb_client
                      yb_test_util
                      yb_client_test_util
                      integration-tests)

set(YB_TEST_LINK_LIBS pggate_test ${YB_MIN_TEST_LIBS})
# Because the pggate_test library depends on a header generated by PostgreSQL build, we can only
# build these tests after PostgrSQL.
add_dependencies(pggate_test postgres)

ADD_YB_TEST(pggate_test_select)
ADD_YB_TEST(pggate_test_select_multi_tablets)
ADD_YB_TEST(pggate_test_delete)
ADD_YB_TEST(pggate_test_update)
ADD_YB_TEST(pggate_test_catalog)

ADD_COMMON_YB_TEST_DEPENDENCIES(pggate_test_select
                                pggate_test_select_multi_tablets
                                pggate_test_catalog)

